﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DataAccess.Content;
using System.Data;
namespace Bussiness.Content
{
    public class ContentBLL
    {
        private ContentDAL dal;
        public ContentBLL()
        {
            dal = new ContentDAL();
        }
        //getContentbyCatandLangIDNoICon(int CatID, int LangID)
        public List<FOModels.Content.LangContent> getContentbyCatandLangID(int CatID, int LangID)
        {
            List<FOModels.Content.LangContent> list = new List<FOModels.Content.LangContent>();
            DataTable tb = dal.getContentbyCatandLangID(CatID, LangID);
            FOModels.Content.LangContent ct;
            if (tb != null && tb.Rows.Count > 0)
            {
                foreach (DataRow r in tb.Rows)
                {
                    ct = new FOModels.Content.LangContent();
                    ct.AuthorID=int.Parse(r["AuthorID"].ToString());
                    ct.ContentID = int.Parse(r[0].ToString());
                    ct.ContentImage = r["ContentImage"].ToString();
                    ct.CountRead = int.Parse(r["CountRead"].ToString());
                    ct.CreatedDate=DateTime.Parse(r["CreateDate"].ToString());
                    ct.Fulltext = r["FullText"].ToString();
                    ct.LangID = int.Parse( r["LangID"].ToString());
                    ct.Publish = bool.Parse(r["Publish"].ToString());
                    ct.ShortText = r["ShortText"].ToString();
                    ct.Title = r["Title"].ToString();
                    list.Add(ct);
                }
            }
            return list;
        }
    }
}
